UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MraeuG8lfz5q+8bpFYDw75Lvw5qjgj2cdg9YApiVOoY=' 
WHERE 
  key_id = 'aaf94bee84cee041f9e5a7b1d664b44f025897a07cb6972de2756409e82354cf' 
  AND (
    token = 'MraeuG8lfz5q+8bpFYDw75Lvw5qjgj2cdg9YApiVOoY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023