UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kysThppDffPHjqfY08yhsRDm7Zb4QszQKPcc3lDgIdc=' 
WHERE 
  key_id = '68965877d141d30d3224e26f01213acc2446fb8d3e1d929469f9d4b31ead3549' 
  AND (
    token = 'kysThppDffPHjqfY08yhsRDm7Zb4QszQKPcc3lDgIdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023