UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x6xWqORDoZQqaEaD2CCVqKZCWU2hZl1a9JlqcX/xrsQ=' 
WHERE 
  key_id = '57eac352c077aa7ec1ea698922d7d907d5cc1c222bdb0f3c3e7b63603890be78' 
  AND (
    token = 'x6xWqORDoZQqaEaD2CCVqKZCWU2hZl1a9JlqcX/xrsQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043